package binary_tree



func PreSerialize(root *TreeNode) []string {
	ans := make([]string, 0)
	PreSerializeProcess(root, &ans)
	return ans
}

func PreSerializeProcess(node *TreeNode, ans *[]string) {
	if node == nil {
		*ans = append(*ans, "nil")
		return
	}
	*ans = append(*ans, node.Value)
	PreSerializeProcess(node.Left, ans)
	PreSerializeProcess(node.Right, ans)
}
